import sys
sys.path.append("..")
import AipSpeech.speech_synthesis as speechSynthesis
from time import sleep
import requests

s = input("请输入话题：")
while True:
    resp = requests.post("http://www.tuling123.com/openapi/api",data={"key": "4fede3c4384846b9a7d0456a5e1e2943", "info": s, })
    resp = resp.json()
    sleep(1)
    print('小鱼：', resp['text'])
    speechSynthesis.play_by_text(resp['text'], 3)
    s = resp['text']
    resp = requests.get("http://api.qingyunke.com/api.php", {'key': 'free', 'appid': 0, 'msg': s})
    resp.encoding = 'utf8'
    resp = resp.json()
    sleep(1)
    print('菲菲：', resp['content'])
    speechSynthesis.play_by_text(resp['content'], 4)